(function($){ 'use strict'; if(typeof wpcf7==='undefined'||wpcf7===null){ return; } wpcf7=$.extend({ cached: 0, inputs: [] }, wpcf7); $(function(){ wpcf7.supportHtml5=(function(){ var features={}; var input=document.createElement('input'); features.placeholder='placeholder' in input; var inputTypes=[ 'email', 'url', 'tel', 'number', 'range', 'date' ]; $.each(inputTypes, function(index, value){ input.setAttribute('type', value); features[ value ]=input.type!=='text'; }); return features; })(); $('div.wpcf7 > form').each(function(){ var $form=$(this); wpcf7.initForm($form); if(wpcf7.cached){ wpcf7.refill($form); }}); }); wpcf7.getId=function(form){ return parseInt($('input[name="_wpcf7"]', form).val(), 10); }; wpcf7.initForm=function(form){ var $form=$(form); $form.submit(function(event){ if(! wpcf7.supportHtml5.placeholder){ $('[placeholder].placeheld', $form).each(function(i, n){ $(n).val('').removeClass('placeheld'); }); } if(typeof window.FormData==='function'){ wpcf7.submit($form); event.preventDefault(); }}); $('.wpcf7-submit', $form).after(''); wpcf7.toggleSubmit($form); $form.on('click', '.wpcf7-acceptance', function(){ wpcf7.toggleSubmit($form); }); $('.wpcf7-exclusive-checkbox', $form).on('click', 'input:checkbox', function(){ var name=$(this).attr('name'); $form.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false); }); $('.wpcf7-list-item.has-free-text', $form).each(function(){ var $freetext=$(':input.wpcf7-free-text', this); var $wrap=$(this).closest('.wpcf7-form-control'); if($(':checkbox, :radio', this).is(':checked')){ $freetext.prop('disabled', false); }else{ $freetext.prop('disabled', true); } $wrap.on('change', ':checkbox, :radio', function(){ var $cb=$('.has-free-text', $wrap).find(':checkbox, :radio'); if($cb.is(':checked')){ $freetext.prop('disabled', false).focus(); }else{ $freetext.prop('disabled', true); }}); }); if(! wpcf7.supportHtml5.placeholder){ $('[placeholder]', $form).each(function(){ $(this).val($(this).attr('placeholder')); $(this).addClass('placeheld'); $(this).focus(function(){ if($(this).hasClass('placeheld')){ $(this).val('').removeClass('placeheld'); }}); $(this).blur(function(){ if(''===$(this).val()){ $(this).val($(this).attr('placeholder')); $(this).addClass('placeheld'); }}); }); } if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.date){ $form.find('input.wpcf7-date[type="date"]').each(function(){ $(this).datepicker({ dateFormat: 'yy-mm-dd', minDate: new Date($(this).attr('min')), maxDate: new Date($(this).attr('max')) }); }); } if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.number){ $form.find('input.wpcf7-number[type="number"]').each(function(){ $(this).spinner({ min: $(this).attr('min'), max: $(this).attr('max'), step: $(this).attr('step') }); }); } $('.wpcf7-character-count', $form).each(function(){ var $count=$(this); var name=$count.attr('data-target-name'); var down=$count.hasClass('down'); var starting=parseInt($count.attr('data-starting-value'), 10); var maximum=parseInt($count.attr('data-maximum-value'), 10); var minimum=parseInt($count.attr('data-minimum-value'), 10); var updateCount=function(target){ var $target=$(target); var length=$target.val().length; var count=down ? starting - length:length; $count.attr('data-current-value', count); $count.text(count); if(maximum&&maximum < length){ $count.addClass('too-long'); }else{ $count.removeClass('too-long'); } if(minimum&&length < minimum){ $count.addClass('too-short'); }else{ $count.removeClass('too-short'); }}; $(':input[name="' + name + '"]', $form).each(function(){ updateCount(this); $(this).keyup(function(){ updateCount(this); }); }); }); $form.on('change', '.wpcf7-validates-as-url', function(){ var val=$.trim($(this).val()); if(val && ! val.match(/^[a-z][a-z0-9.+-]*:/i) && -1!==val.indexOf('.')){ val=val.replace(/^\/+/, ''); val='http://' + val; } $(this).val(val); }); }; wpcf7.submit=function(form){ if(typeof window.FormData!=='function'){ return; } var $form=$(form); $('.ajax-loader', $form).addClass('is-active'); wpcf7.clearResponse($form); var formData=new FormData($form.get(0)); var detail={ id: $form.closest('div.wpcf7').attr('id'), status: 'init', inputs: [], formData: formData }; $.each($form.serializeArray(), function(i, field){ if('_wpcf7'==field.name){ detail.contactFormId=field.value; }else if('_wpcf7_version'==field.name){ detail.pluginVersion=field.value; }else if('_wpcf7_locale'==field.name){ detail.contactFormLocale=field.value; }else if('_wpcf7_unit_tag'==field.name){ detail.unitTag=field.value; }else if('_wpcf7_container_post'==field.name){ detail.containerPostId=field.value; }else if(field.name.match(/^_wpcf7_\w+_free_text_/)){ var owner=field.name.replace(/^_wpcf7_\w+_free_text_/, ''); detail.inputs.push({ name: owner + '-free-text', value: field.value }); }else if(field.name.match(/^_/)){ }else{ detail.inputs.push(field); }}); wpcf7.triggerEvent($form.closest('div.wpcf7'), 'beforesubmit', detail); var ajaxSuccess=function(data, status, xhr, $form){ detail.id=$(data.into).attr('id'); detail.status=data.status; detail.apiResponse=data; var $message=$('.wpcf7-response-output', $form); switch(data.status){ case 'validation_failed': $.each(data.invalidFields, function(i, n){ $(n.into, $form).each(function(){ wpcf7.notValidTip(this, n.message); $('.wpcf7-form-control', this).addClass('wpcf7-not-valid'); $('[aria-invalid]', this).attr('aria-invalid', 'true'); }); }); $message.addClass('wpcf7-validation-errors'); $form.addClass('invalid'); wpcf7.triggerEvent(data.into, 'invalid', detail); break; case 'acceptance_missing': $message.addClass('wpcf7-acceptance-missing'); $form.addClass('unaccepted'); wpcf7.triggerEvent(data.into, 'unaccepted', detail); break; case 'spam': $message.addClass('wpcf7-spam-blocked'); $form.addClass('spam'); wpcf7.triggerEvent(data.into, 'spam', detail); break; case 'aborted': $message.addClass('wpcf7-aborted'); $form.addClass('aborted'); wpcf7.triggerEvent(data.into, 'aborted', detail); break; case 'mail_sent': $message.addClass('wpcf7-mail-sent-ok'); $form.addClass('sent'); wpcf7.triggerEvent(data.into, 'mailsent', detail); break; case 'mail_failed': $message.addClass('wpcf7-mail-sent-ng'); $form.addClass('failed'); wpcf7.triggerEvent(data.into, 'mailfailed', detail); break; default: var customStatusClass='custom-' + data.status.replace(/[^0-9a-z]+/i, '-'); $message.addClass('wpcf7-' + customStatusClass); $form.addClass(customStatusClass); } wpcf7.refill($form, data); wpcf7.triggerEvent(data.into, 'submit', detail); if('mail_sent'==data.status){ $form.each(function(){ this.reset(); }); wpcf7.toggleSubmit($form); } if(! wpcf7.supportHtml5.placeholder){ $form.find('[placeholder].placeheld').each(function(i, n){ $(n).val($(n).attr('placeholder')); }); } $message.html('').append(data.message).slideDown('fast'); $message.attr('role', 'alert'); $('.screen-reader-response', $form.closest('.wpcf7')).each(function(){ var $response=$(this); $response.html('').attr('role', '').append(data.message); if(data.invalidFields){ var $invalids=$('
c&&((A=document.createElement(t.slideElement)).className=t.slideClass,A.setAttribute("data-swiperindex",n),A.innerHTML=e[n],d.wrapper.appendChild(A))}}d.reInit(!0)}},d.calcSlides(),t.loader.slides.length>0&&0===d.slides.length&&d.loadSlides(),t.loop&&d.createLoop(),d.init(),function(){var e,i,n,r,s=d.h.addEventListener,a="wrapper"===t.eventTarget?d.wrapper:d.container;if(d.browser.ie10||d.browser.ie11?(s(a,d.touchEvents.touchStart,z),s(document,d.touchEvents.touchMove,N),s(document,d.touchEvents.touchEnd,V)):(d.support.touch&&(s(a,"touchstart",z),s(a,"touchmove",N),s(a,"touchend",V)),t.simulateTouch&&(s(a,"mousedown",z),s(document,"mousemove",N),s(document,"mouseup",V))),t.autoResize&&s(window,"resize",d.resizeFix),F(),d._wheelEvent=!1,t.mousewheelControl){if(void 0!==document.onmousewheel&&(d._wheelEvent="mousewheel"),!d._wheelEvent)try{new WheelEvent("wheel"),d._wheelEvent="wheel"}catch(e){}d._wheelEvent||(d._wheelEvent="DOMMouseScroll"),d._wheelEvent&&s(d.container,d._wheelEvent,D)}if(t.keyboardControl&&s(document,"keydown",P),t.updateOnImagesReady){d.imagesToLoad=k("img",d.container);for(var o=0;o 0&&(!t.freeMode||t.freeModeFluid)&&(d.positions.current=0),d.positions.current<-W()&&(!t.freeMode||t.freeModeFluid)&&(d.positions.current=-W())),!t.followFinger)return;if(t.moveStartThreshold)if(Math.abs(d.touches.current-d.touches.start)>t.moveStartThreshold||C){if(!C)return C=!0,void(d.touches.start=d.touches.current);d.setWrapperTranslate(d.positions.current)}else d.positions.current=d.positions.start;else d.setWrapperTranslate(d.positions.current);return(t.freeMode||t.watchActiveIndex)&&d.updateActiveSlide(d.positions.current),t.grabCursor&&(d.container.style.cursor="move",d.container.style.cursor="grabbing",d.container.style.cursor="-moz-grabbin",d.container.style.cursor="-webkit-grabbing"),b||(b=d.touches.current),x||(x=(new Date).getTime()),d.velocity=(d.touches.current-b)/((new Date).getTime()-x)/2,Math.abs(d.touches.current-b)<2&&(d.velocity=0),b=d.touches.current,x=(new Date).getTime(),d.callPlugins("onTouchMoveEnd"),t.onTouchMove&&d.fireCallback(t.onTouchMove,d,e),!1}}}}function V(e){if(o&&d.swipeReset(),!t.onlyExternal&&d.isTouched){d.isTouched=!1,t.grabCursor&&(d.container.style.cursor="move",d.container.style.cursor="grab",d.container.style.cursor="-moz-grab",d.container.style.cursor="-webkit-grab"),d.positions.current||0===d.positions.current||(d.positions.current=d.positions.start),t.followFinger&&d.setWrapperTranslate(d.positions.current),d.times.end=(new Date).getTime(),d.touches.diff=d.touches.current-d.touches.start,d.touches.abs=Math.abs(d.touches.diff),d.positions.diff=d.positions.current-d.positions.start,d.positions.abs=Math.abs(d.positions.diff);var i=d.positions.diff,n=d.positions.abs,s=d.times.end-d.times.start;n<5&&s<300&&!1===d.allowLinks&&(t.freeMode||0===n||d.swipeReset(),t.preventLinks&&(d.allowLinks=!0),t.onSlideClick&&(d.allowSlideClick=!0)),setTimeout(function(){null!=d&&(t.preventLinks&&(d.allowLinks=!0),t.onSlideClick&&(d.allowSlideClick=!0))},100);var p=W();if(!d.isMoved&&t.freeMode)return d.isMoved=!1,t.onTouchEnd&&d.fireCallback(t.onTouchEnd,d,e),void d.callPlugins("onTouchEnd");if(!d.isMoved||d.positions.current>0||d.positions.current<-p)return d.swipeReset(),t.onTouchEnd&&d.fireCallback(t.onTouchEnd,d,e),void d.callPlugins("onTouchEnd");if(d.isMoved=!1,t.freeMode){if(t.freeModeFluid){var c,u=1e3*t.momentumRatio,h=d.velocity*u,f=d.positions.current+h,g=!1,w=20*Math.abs(d.velocity)*t.momentumBounceRatio;f<-p&&(t.momentumBounce&&d.support.transitions?(f+p<-w&&(f=-p-w),c=-p,g=!0,M=!0):f=-p),f>0&&(t.momentumBounce&&d.support.transitions?(f>w&&(f=w),c=0,g=!0,M=!0):f=0),0!==d.velocity&&(u=Math.abs((f-d.positions.current)/d.velocity)),d.setWrapperTranslate(f),d.setWrapperTransition(u),t.momentumBounce&&g&&d.wrapperTransitionEnd(function(){M&&(t.onMomentumBounce&&d.fireCallback(t.onMomentumBounce,d),d.callPlugins("onMomentumBounce"),d.setWrapperTranslate(c),d.setWrapperTransition(300))}),d.updateActiveSlide(f)}return(!t.freeModeFluid||s>=300)&&d.updateActiveSlide(d.positions.current),t.onTouchEnd&&d.fireCallback(t.onTouchEnd,d,e),void d.callPlugins("onTouchEnd")}"toNext"===(a=i<0?"toNext":"toPrev")&&s<=300&&(n<30||!t.shortSwipes?d.swipeReset():d.swipeNext(!0,!0)),"toPrev"===a&&s<=300&&(n<30||!t.shortSwipes?d.swipeReset():d.swipePrev(!0,!0));var v=0;if("auto"===t.slidesPerView){for(var m,S=Math.abs(d.getWrapperTranslate()),y=0,T=0;T');var c=e.vertical?"margin-left":"margin-top";p.parent().find(".lSPager").css(c,e.galleryMargin+"px"),z.createPager()}setTimeout(function(){z.init()},0)},setHeight:function(a,b){var c=null,d=this;c=e.loop?a.children(".lslide ").first():a.children().first();var f=function(){var d=c.outerHeight(),e=0,f=d;b&&(d=0,e=100*f/o),a.css({height:d+"px","padding-bottom":e+"%"})};f(),c.find("img").length?c.find("img")[0].complete?(f(),x||d.auto()):c.find("img").on("load",function(){setTimeout(function(){f(),x||d.auto()},100)}):x||d.auto()},active:function(a,b){this.doCss()&&"fade"===e.mode&&p.addClass("on");var c=0;if(q*e.slideMove
';
obj=iL.normalizeSocial(obj, url);
$.each(obj, function(key, value){
var item=key.toLowerCase(),
source=value.source.replace(/\{URL\}/g, encodeURIComponent(value.URL).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'));
buttons +='
';
socialBar.html(buttons);
$('div.ilightbox-container', target).append(socialBar);
},
fullScreenAction: function(){
var iL=this,
vars=iL.vars;
if(fullScreenApi.supportsFullScreen){
if(fullScreenApi.isFullScreen()) fullScreenApi.cancelFullScreen(document.documentElement);
else fullScreenApi.requestFullScreen(document.documentElement);
}else{
iL.doFullscreen();
}},
doFullscreen: function(){
var iL=this,
vars=iL.vars,
viewport=getViewport(),
opts=iL.options;
if(opts.fullAlone){
var currentHolder=vars.holder,
current=iL.items[vars.current],
windowWidth=viewport.width,
windowHeight=viewport.height,
elements=[currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader],
hideElements=[vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
if(!vars.isInFullScreen){
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=true;
vars.overlay.css({
opacity: 1
});
$.each(hideElements, function(i, element){
element.hide();
});
vars.fullScreenButton.attr('title', opts.text.exitFullscreen);
if(opts.fullStretchTypes.indexOf(current.type)!=-1) currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: windowWidth,
naturalHeight: windowHeight
});
else {
var viewport=current.options.fullViewPort||opts.fullViewPort||'',
newWidth=windowWidth,
newHeight=windowHeight,
width=currentHolder.data('naturalWidth'),
height=currentHolder.data('naturalHeight');
if(viewport.toLowerCase()=='fill'){
newHeight=(newWidth / width) * height;
if(newHeight < windowHeight){
newWidth=(windowHeight / height) * width,
newHeight=windowHeight;
}}else if(viewport.toLowerCase()=='fit'){
var dims=iL.getNewDimenstions(newWidth, newHeight, width, height, true);
newWidth=dims.width,
newHeight=dims.height;
}else if(viewport.toLowerCase()=='stretch'){
newWidth=newWidth,
newHeight=newHeight;
}else{
var scale=(width > newWidth||height > newHeight) ? true:false,
dims=iL.getNewDimenstions(newWidth, newHeight, width, height, scale);
newWidth=dims.width,
newHeight=dims.height;
}
currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: newWidth,
naturalHeight: newHeight
});
}
$.each(elements, function(key, val){
val.addClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onEnterFullScreen=='function') opts.callback.onEnterFullScreen.call(iL, iL.ui);
}else{
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=false;
vars.overlay.css({
opacity: iL.options.overlay.opacity
});
$.each(hideElements, function(i, element){
element.show();
});
vars.fullScreenButton.attr('title', opts.text.enterFullscreen);
currentHolder.data({
naturalWidth: currentHolder.data('naturalWidthOld'),
naturalHeight: currentHolder.data('naturalHeightOld'),
naturalWidthOld: null,
naturalHeightOld: null
});
$.each(elements, function(key, val){
val.removeClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onExitFullScreen=='function') opts.callback.onExitFullScreen.call(iL, iL.ui);
}}else{
if(!vars.isInFullScreen) vars.isInFullScreen=true;
else vars.isInFullScreen=false;
}
iL.repositionPhoto(true);
},
closeAction: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
$win.unbind('.iLightBox');
$doc.off('.iLightBox');
if(vars.isInFullScreen) fullScreenApi.cancelFullScreen(document.documentElement);
$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox');
if(opts.hide.effect) vars.overlay.stop().fadeOut(opts.hide.speed, function(){
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
});
else {
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
}
var fadeOuts=[vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
$.each(fadeOuts, function(i, element){
element.removeAttr('style').remove();
});
vars.dontGenerateThumbs=vars.isInFullScreen=false;
window.iLightBox=null;
if(opts.linkId){
vars.hashLock=true;
removeHash();
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(typeof opts.callback.onHide=='function') opts.callback.onHide.call(iL, iL.ui);
},
repositionPhoto: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
winWidth=viewport.width,
winHeight=viewport.height;
var thumbsOffsetW=(vars.isInFullScreen&&opts.fullAlone||vars.isMobile) ? 0:((path=='horizontal') ? 0:vars.thumbnails.outerWidth()),
thumbsOffsetH=vars.isMobile ? vars.toolbar.outerHeight():((vars.isInFullScreen&&opts.fullAlone) ? 0:((path=='horizontal') ? vars.thumbnails.outerHeight():0)),
width=(vars.isInFullScreen&&opts.fullAlone) ? winWidth:(winWidth - (opts.styles.pageOffsetX)),
height=(vars.isInFullScreen&&opts.fullAlone) ? winHeight:(winHeight - (opts.styles.pageOffsetY)),
offsetW=(path=='horizontal') ? parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((width / 10) <=30) ? 30:(width / 10))):parseInt(((width / 10) <=30) ? 30:(width / 10)) + thumbsOffsetW,
offsetH=(path=='horizontal') ? parseInt(((height / 10) <=30) ? 30:(height / 10)) + thumbsOffsetH:parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((height / 10) <=30) ? 30:(height / 10)));
var elObject={
type: 'current',
width: width,
height: height,
item: iL.items[vars.current],
offsetW: offsetW,
offsetH: offsetH,
thumbsOffsetW: thumbsOffsetW,
thumbsOffsetH: thumbsOffsetH,
animate: arguments.length,
holder: vars.holder
};
iL.repositionEl(elObject);
if(iL.items[vars.next]){
elObject=$.extend(elObject, {
type: 'next',
item: iL.items[vars.next],
offsetX: opts.styles.nextOffsetX,
offsetY: opts.styles.nextOffsetY,
holder: vars.nextPhoto
});
iL.repositionEl(elObject);
}
if(iL.items[vars.prev]){
elObject=$.extend(elObject, {
type: 'prev',
item: iL.items[vars.prev],
offsetX: opts.styles.prevOffsetX,
offsetY: opts.styles.prevOffsetY,
holder: vars.prevPhoto
});
iL.repositionEl(elObject);
}
var loaderCss=(path=="horizontal") ? {
left: parseInt((width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.css(loaderCss);
},
repositionEl: function(obj){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
widthAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.width:(obj.width - obj.offsetW)):(obj.width - obj.offsetW),
heightAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.height:(obj.height - obj.offsetH)):(obj.height - obj.offsetH),
itemParent=obj.item,
item=obj.item.options,
holder=obj.holder,
offsetX=obj.offsetX||0,
offsetY=obj.offsetY||0,
thumbsOffsetW=obj.thumbsOffsetW,
thumbsOffsetH=obj.thumbsOffsetH;
if(obj.type=='current'){
if(typeof item.width=='number'&&item.width) widthAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? widthAvail:((item.width > widthAvail) ? widthAvail:item.width);
if(typeof item.height=='number'&&item.height) heightAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? heightAvail:((item.height > heightAvail) ? heightAvail:item.height);
}else{
if(typeof item.width=='number'&&item.width) widthAvail=(item.width > widthAvail) ? widthAvail:item.width;
if(typeof item.height=='number'&&item.height) heightAvail=(item.height > heightAvail) ? heightAvail:item.height;
}
if(opts.innerToolbar)
heightAvail=parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight());
var width=(typeof item.width=='string'&&item.width.indexOf('%')!=-1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width):holder.data('naturalWidth'),
height=(typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height):holder.data('naturalHeight');
var dims=((typeof item.width=='string'&&item.width.indexOf('%')!=-1||typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? {
width: width,
height: height
}:iL.getNewDimenstions(widthAvail, heightAvail, width, height)),
newDims=$.extend({}, dims, {});
if(obj.type=='prev'||obj.type=='next')
width=parseInt(dims.width * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale)),
height=parseInt(dims.height * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale));
else
width=dims.width,
height=dims.height;
var widthDiff=parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2),
heightDiff=parseInt((getPixel(holder, 'padding-top') + getPixel(holder, 'padding-bottom') + getPixel(holder, 'border-top-width') + getPixel(holder, 'border-bottom-width') + ($('.ilightbox-inner-toolbar', holder).outerHeight()||0)) / 2);
switch (obj.type){
case 'current':
var top=parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)),
left=parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
case 'next':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2));
break;
case 'prev':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
}
holder.data('offset', {
top: top,
left: left,
newDims: newDims,
diff: {
W: widthDiff,
H: heightDiff
},
thumbsOffset: {
W: thumbsOffsetW,
H: thumbsOffsetH
},
object: obj
});
if(obj.animate > 0&&opts.effects.reposition){
holder.css(transform, gpuAcceleration).stop().animate({
top: top,
left: left
}, opts.effects.repositionSpeed, 'easeOutCirc', function(){
holder.css(transform, '');
});
$('div.ilightbox-container', holder).stop().animate({
width: width,
height: height
}, opts.effects.repositionSpeed, 'easeOutCirc');
$('div.ilightbox-inner-toolbar', holder).stop().animate({
width: width
}, opts.effects.repositionSpeed, 'easeOutCirc', function(){
$(this).css('overflow', 'visible');
});
}else{
holder.css({
top: top,
left: left
});
$('div.ilightbox-container', holder).css({
width: width,
height: height
});
$('div.ilightbox-inner-toolbar', holder).css({
width: width
});
}},
resume: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(!opts.slideshow.pauseTime||opts.controls.slideshow&&vars.total <=1||priority < vars.isPaused){
return;
}
vars.isPaused=0;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}
vars.cycleID=setTimeout(function(){
if(vars.current==vars.total - 1) iL.goTo(0);
else iL.moveTo('next');
}, opts.slideshow.pauseTime);
},
pause: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(priority < vars.isPaused){
return;
}
vars.isPaused=priority||100;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}},
resetCycle: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.controls.slideshow&&vars.cycleID&&!vars.isPaused){
iL.resume();
}},
getNewDimenstions: function(width, height, width_old, height_old, thumb){
var iL=this;
if(!width) factor=height / height_old;
else if(!height) factor=width / width_old;
else factor=min(width / width_old, height / height_old);
if(!thumb){
if(factor > iL.options.maxScale) factor=iL.options.maxScale;
else if(factor < iL.options.minScale) factor=iL.options.minScale;
}
var final_width=(iL.options.keepAspectRatio) ? round(width_old * factor):width,
final_height=(iL.options.keepAspectRatio) ? round(height_old * factor):height;
return {
width: final_width,
height: final_height,
ratio: factor
};},
setOption: function(options){
var iL=this;
iL.options=$.extend(true, iL.options, options||{});
iL.refresh();
},
availPlugins: function(){
var iL=this,
testEl=document.createElement("video");
iL.plugins={
flash: !isMobile,
quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >=0) ? true:false,
html5H264: !!(testEl.canPlayType&&testEl.canPlayType('video/mp4').replace(/no/, '')),
html5WebM: !!(testEl.canPlayType&&testEl.canPlayType('video/webm').replace(/no/, '')),
html5Vorbis: !!(testEl.canPlayType&&testEl.canPlayType('video/ogg').replace(/no/, '')),
html5QuickTime: !!(testEl.canPlayType&&testEl.canPlayType('video/quicktime').replace(/no/, ''))
};},
addContent: function(element, obj){
var iL=this,
el;
switch (obj.type){
case 'video':
var HTML5=false,
videoType=obj.videoType,
html5video=obj.options.html5video;
if(((videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')||html5video.h264)&&iL.plugins.html5H264)
obj.ext='mp4',
obj.URL=html5video.h264||obj.URL;
else if(html5video.webm&&iL.plugins.html5WebM)
obj.ext='webm',
obj.URL=html5video.webm||obj.URL;
else if(html5video.ogg&&iL.plugins.html5Vorbis)
obj.ext='ogv',
obj.URL=html5video.ogg||obj.URL;
if(iL.plugins.html5H264&&(videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')) HTML5=true, videoType="video/mp4";
else if(iL.plugins.html5WebM&&(videoType=='video/webm'||obj.ext=='webm')) HTML5=true, videoType="video/webm";
else if(iL.plugins.html5Vorbis&&(videoType=='video/ogg'||obj.ext=='ogv')) HTML5=true, videoType="video/ogg";
else if(iL.plugins.html5QuickTime&&(videoType=='video/quicktime'||obj.ext=='mov'||obj.ext=='qt')) HTML5=true, videoType="video/quicktime";
if(HTML5){
el=$('', {
"width": "100%",
"height": "100%",
"preload": html5video.preload,
"autoplay": html5video.autoplay,
"poster": html5video.poster,
"controls": html5video.controls
}).append($('', {
"src": obj.URL,
"type": videoType
}));
}else{
if(!iL.plugins.quicktime) el=$('', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime')
});
else {
el=$('', {
"type": "video/quicktime",
"pluginspage": pluginspages.quicktime
}).attr({
"data": obj.URL,
"width": "100%",
"height": "100%"
}).append($('', {
"name": "src",
"value": obj.URL
})).append($('', {
"name": "autoplay",
"value": "false"
})).append($('', {
"name": "loop",
"value": "false"
})).append($('', {
"name": "scale",
"value": "tofit"
}));
if(browser.msie) el=QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false');
}}
break;
case 'flash':
if(!iL.plugins.flash) el=$('', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player')
});
else {
var flashvars="",
i=0;
if(obj.options.flashvars) $.each(obj.options.flashvars, function(k, v){
if(i!=0) flashvars +="&";
flashvars +=k + "=" + encodeURIComponent(v);
i++;
});
else flashvars=null;
el=$('').attr({
"type": "application/x-shockwave-flash",
"src": obj.URL,
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
"quality": "high",
"bgcolor": "#000000",
"play": "true",
"loop": "true",
"menu": "true",
"wmode": "transparent",
"scale": "showall",
"allowScriptAccess": "always",
"allowFullScreen": "true",
"flashvars": flashvars,
"fullscreen": "yes"
});
}
break;
case 'iframe':
el=$('').attr({
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
src: obj.URL,
frameborder: 0,
'hspace': 0,
'vspace': 0,
'scrolling': supportTouch ? 'auto':'scroll',
'webkitAllowFullScreen': '',
'mozallowfullscreen': '',
'allowFullScreen': ''
});
break;
case 'inline':
el=$('').html($(obj.URL).clone(true));
break;
case 'html':
var object=obj.URL,
el;
if(object[0].nodeName){
el=$('').html(object);
}else{
var dom=$(obj.URL),
html=(dom.selector) ? $('